package com.jams.goodox.constant;

import android.content.Context;
import android.content.pm.PackageManager;
import android.provider.Settings;

import com.jams.goodox.BuildConfig;

/**
 * Description: App基础配置
 */
public class AppConfig {
    //**********************************************************************  开发环境在这里修改  **********************

    // 请求的加密key
    public static final String KEY = "uama1209";
    // 请求的版本信息
    public static final String VERSION = "2";
    public static final String COMPANY_CODE = "tw";
    public static final String MOBILE_TYPE = "20";
    public static final int PagSize = 20;//分页每页请求数量
    public static final String RETURN_SUCCESS = "100";//返回成功

    //获取服务器地址
    public static String getServerUrl() {
        return BuildConfig.BASE_URL ;
    }

    //获取手机系统版本号
    public static String getOSVersion() {
        return android.os.Build.VERSION.RELEASE;
    }

    //获取APP版本号
    public static String getAppVersion(Context context) {
        try {
            return context.getPackageManager().getPackageInfo(
                    context.getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            return "Obtain app version error!";
        }
    }

    //获取手机设备号
    public static String getAndroidId(Context context) {
        try {
            return Settings.Secure.getString(context.getContentResolver(),
                    Settings.Secure.ANDROID_ID);
        } catch (Exception e) {
            return "Obtain serverId error!";
        }
    }

    //获取设备名称
    public static String getMobileName() {
        return android.os.Build.MANUFACTURER + " " + android.os.Build.MODEL;
    }
}
